package com.sky.config;

import com.sky.properties.AliOssProperties;
import com.sky.utils.AliOssUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类，阿里云图片上传
 */
@Configuration
@Slf4j
public class AliOssConfiguration {
    @Bean
    public AliOssUtil aliOss(AliOssProperties aliOssProperties){
        log.info("阿里云图片上传工具类启动...");
        return new AliOssUtil(
                aliOssProperties.getEndpoint(),
                aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(),
                aliOssProperties.getBucketName());
    }
}
